﻿namespace SS.WPF.Framework.Restriction
{
    using System;

    public class IntegerEnumRestriction : EnumRestriction<int>
    {
        public override bool Validate(int value)
        {
            try
            {
                Enum.ToObject(EnumType, value);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }

    public class DoubleEnumRestriction : EnumRestriction<double>
    {
        public override bool Validate(double value)
        {
            try
            {
                Enum.ToObject(EnumType, (int)value);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}